/************************************************************************/
// Copyright (C) 2016, han_gangbiao. All rights reserved.
// Use of this source code is governed by a GPL-v2 license that can be found in the License file.
// 
// [Time]:      2016-1-4 21:53:17
// [Author]:    han_gangbiao [http://my.oschina.net/jackhen]
// [Info]:      
/************************************************************************/

#include "tpsserver.h"

net_reactor_t g_reactor_engine;

int main(int argc, char* argv[])
{
	CTPSServer* ppService = new CTPSServer(&g_reactor_engine);
    
    g_reactor_engine.init_reactor(ppService, 4);
    
	SOCK_FD listenfd = ppService->startListen("0.0.0.0", 8800);
    if(listenfd > 0)
    {
        printf("start tpsserver listen at[0.0.0.0:8800], listenfd=[%d]\n", listenfd);
    }
    else
    {
        printf("tpsserver failed listen at[0.0.0.0:8800]\n");
    }


	char c;
	do{
		c = getchar();
		SLEEP_MS(100);

		printf("Press q or Q to exit...\n");
	}while(c!='q' && c!='Q');
    
	g_reactor_engine.close_fd(listenfd);
    g_reactor_engine.uninit_reactor();
    SAFE_DELETE(ppService);
	return 0;
}

